package cn.xhjava.crm.workbench.controller.chat;

import cn.xhjava.crm.workbench.domain.DateDataMapVO;
import cn.xhjava.crm.workbench.domain.FunnelVO;
import cn.xhjava.crm.workbench.service.TranService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

@Controller
public class TransactionChartController {
    @Autowired
    private TranService tranService;

    @RequestMapping("/workbench/chart/transaction/index")
    public String transactionIndex() {
        //跳转页面
        return "workbench/chart/transaction/index";

    }

    @RequestMapping("/workbench/chart/transaction/queryCountOfTranGroupByStage")
    public @ResponseBody
    Object queryCountOfTranGroupByStage() throws Exception {
        //调用service层方法，查询数据
        List<FunnelVO> funnelVOList = tranService.queryCountOfTranGroupByStage();
        //根据查询结果，返回响应信息
        return funnelVOList;
    }

    @RequestMapping("/workbench/chart/tran/queryMoneyCountGroupByCreateTime")
    public @ResponseBody
    Object queryMoneyCountGroupByCreateTime() throws Exception {
        DateDataMapVO dateDataMapVO = tranService.queryMoneyCountGroupByCreateTime();
        return dateDataMapVO;
    }
}
